package com.yiidata.rpc.grpc;

import io.grpc.stub.StreamObserver;
import lombok.extern.slf4j.Slf4j;

/**
 * <pre>
 *
 * Created by zhenqin.
 * User: zhenqin
 * Date: 2019/4/27
 * Time: 12:30
 * Vendor: yiidata.com
 * To change this template use File | Settings | File Templates.
 *
 * </pre>
 *
 * @author zhenqin
 */
@Slf4j
public class HelloServiceProtocol extends GreeterGrpc.GreeterImplBase {

    @Override
    public void sayHello(HelloRequest request, StreamObserver<com.yiidata.rpc.grpc.HelloReply> responseObserver) {
        String result = "Hello, " + request.getName();
        log.info(result);
        com.yiidata.rpc.grpc.HelloReply response = HelloReply.newBuilder().setMessage(result).build();
        responseObserver.onNext(response);
        responseObserver.onCompleted();
    }
}
